package com.myspring.resttest;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.myspring.resttest.model.Student;
import com.myspring.resttest.model.StudentList;

@RestController
public class DataController {
	Logger logger = Logger.getLogger(DataController.class);
	/*//@RequestMapping(value = "student", produces = "application/json")*/
	@RequestMapping(value = "student")	
	public Student getStudent() {
		logger.info("Inside the right controller with json handler triggered\n");
		return new Student(23, "Meghnaa", "Naidu", "meghna@gmail.com",
				"8978767878");
	}

	@RequestMapping("studentlist")
	public StudentList getStudentList() {
		List<Student> studentList = new ArrayList<Student>();
		studentList.add(new Student(3, "Robert", "Parera", "robert@gmail.com",
				"8978767878"));
		studentList.add(new Student(93, "Andrew", "Strauss",
				"andrew@gmail.com", "8978767878"));
		studentList.add(new Student(239, "Eddy", "Knight", "knight@gmail.com",
				"7978767878"));

		return new StudentList(studentList);
	}

}